package com.mollytask.base;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mollytask.R;
import com.mollytask.bean.Message;

import java.util.List;

/**
 * Created by freshxu on 2017/5/30.
 */

public class MessageAdapter extends BaseQuickAdapter<Message, BaseViewHolder> {


    public MessageAdapter(@LayoutRes int layoutResId, @Nullable List<Message> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Message item) {
        helper.setText(R.id.message_type, item.getType() == 0 ? "催报消息" : "通知消息");
        if (item.getType() == 0) {
            helper.setTextColor(R.id.message_type, mContext.getResources().getColor(R.color.status_yes));
        } else {
            helper.setTextColor(R.id.message_type, mContext.getResources().getColor(R.color.status_not));

        }
        helper.setText(R.id.message_content, item.getmContent());
        helper.setText(R.id.message_time, item.getCreatedAt());
    }
}
